<?php

if ( ! defined ('HC_BOOTSTRAPPED') ) {

    // If he HC PHP directory has not already been included, we should
    // try to do so now.

    if ( ! defined('HC_PHP_DIR') ) {
        if ( isset($_SERVER['HC_PHP_DIR']) ) {
            // If the HC PHP directory is not already defined and it is
            // specified in the environment, we should use that.
            define('HC_PHP_DIR', $_SERVER['HC_PHP_DIR']);
        } else {
            // Try to look for HC PHP directory ( hc-php ) based on
            // the locatin of THIS file.
            foreach ( array(
                dirname(dirname(__FILE__)),
                dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'vendors',
            ) as $hcPhpDirTest ) {
                $hcPhpDirPath =
                    $hcPhpDirTest . DIRECTORY_SEPARATOR . 'hc-php';
                if ( file_exists($hcPhpDirPath) ) {
                    define('HC_PHP_DIR', $hcPhpDirPath);
                    break;
                }
            }
        }
    }

    if ( defined('HC_PHP_DIR') ) {
        $paths = explode(PATH_SEPARATOR, get_include_path());
        if ( ! in_array(HC_PHP_DIR, $paths) ) {
            $paths[] = HC_PHP_DIR;
            set_include_path(implode(PATH_SEPARATOR, $paths));
        }
    } else {
        define('HC_PHP_DIR', '.');
    }

    define('HC_BOOTSTRAPPED', true);

}

require_once('hc_core_FileLocator.php');
require_once('hc_core_ClassLoader.php');

?>
